from typing import Union, Literal
from pydantic import BaseModel

# 基类参数
class BaseParams(BaseModel):
    timeframe: Literal["1m","15m","1H","D"]
    max_drawdown: float = 0.1
    data_sources: list

# 外汇参数
class FXParams(BaseParams):
    asset_type: Literal["外汇"]
    currency_pair: str
    leverage: float = 50.0

# 债券参数
class BondParams(BaseParams):
    asset_type: Literal["债券"]
    duration_type: Literal["短端","中端","长端"]
    credit_rating: str

# 贵金属参数
class MetalParams(BaseParams):
    asset_type: Literal["贵金属"]
    metal_type: Literal["黄金","白银","铂金"]
    market: Literal["现货","期货"]

# 联合类型
AssetParams = Union[FXParams, BondParams, MetalParams]